/*! @file sqlitedb.h
 * @brief This Class holds the various values of an database object
 *
 */

#ifndef SQLITEDB_H
#define SQLITEDB_H

#include <QDate>
#include <QFileInfo>
#include <QList>
#include <QString>

#include "defines.h"
#include "sqlite3.h"

//! @brief This Class holds the various values of an database object
class SqliteDb
{
public:
    SqliteDb( QString );        /*!< @param dbfile QString path to Db File */
    ~SqliteDb();

    int             counter;
    QString         dbtype;                         /*!< like: 'firefox', 'android', ... */
    QList<QStringList>  fields;
    QFileInfo       fileinfo;                       /*!< file information */
    QString         filename;                       /*!< just filename */
    QDate           first_entry;                    /*!< Datestamp of first entry */
    sqlite3         *handle;                        /*!< handle to dbfile */
    QDate           last_entry;                     /*!< Datestamp of last entry */
    QString         longpath;                       /*!< path including filename */
    QString         path;                           /*!< path w/o filename */
    QList<QString>  tables;                         /*!< tables in database */
    bool            tpl_exists;                     /*!< template exists? */
public Q_SLOTS:
    void            addTable( QString );            /*!< setter function */
    QList<QDate>    getDates();                     /*!< returns first/last entry date */
    QList<QString>  getFields(int);
    QString         getFileName();                  /*!< returns filename w/o path */
    int             getIntType();                   /*!< returns filetype as int */
    QString         getLongPath();                  //!< returns path including filename
    QString         getPath();                      /*!< returns path w/o filename */
    double          getSizeMb();                    /*!< getter function */
    QList<QString>  getTables();                    /*!< returns DB tables */
    QString         getType();                      /*!< returns filetype as QString */
    void            setTables( QList<QString> );    /*!< setter function */
    bool            isTableEmpty(QString);          /*!< is table empty? */

private:
    QList<QDate>    Dates;
    sqlite3         *db;

private Q_SLOTS:
    void            _getDates( sqlite3* );          /*!< private slot */
    QList<QString>  _getFields( sqlite3*, QString );         /*!< private slot */
    QList<QString>  _getTables( sqlite3* );         /*!< private slot */
    QString         _identifyDb( sqlite3* );        /*!< private slot */
    int             _instantiateDb();               /*!< private slot */
};

#endif // SQLITEDB_H
